﻿using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.GeoAnalyst;
using ESRI.ArcGIS.SystemUI;
using System;
using System.Drawing;
using ESRI.ArcGIS.esriSystem;

namespace PlanningGIS.Framework
{
    /// <summary>
    /// 
    /// </summary>
    public class HookHelperExClass : IHookHelper, IHookActions
    {
        /// <summary>
        /// 
        /// </summary>
        private IApplication m_Application;
        /// <summary>
        /// 
        /// </summary>
        IHookHelper m_HookHelper = new HookHelperClass();
        /// <summary>
        /// 
        /// </summary>
        public HookHelperExClass()
        {

        }
        /// <summary>
        /// 
        /// </summary>
        public IActiveView ActiveView
        {
            get
            {
                return (m_Application.Document as IMxDocument).ActiveView;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public IMap FocusMap
        {
            get
            {
                return (m_Application.Document as IMxDocument).FocusMap;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public object Hook
        {
            get
            {
                return m_Application as object;
               
            }
            set
            {
                m_Application = value as IApplication;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public IOperationStack OperationStack
        {
            get
            {
                return this.m_Application.OperationStack;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public IPageLayout PageLayout
        {
            get
            {
                return (this.m_Application.Document as IMxDocument).PageLayout;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pUnknown"></param>
        /// <param name="Action"></param>
        public void DoAction(object pUnknown, esriHookActions Action)
        {
            m_HookHelper.Hook = (this.m_Application as IFramework).Object;
            (m_HookHelper as IHookActions).DoAction(pUnknown, Action);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pArray"></param>
        /// <param name="Action"></param>
        public void DoActionOnMultiple(IArray pArray, esriHookActions Action)
        {
            m_HookHelper.Hook = (this.m_Application as IFramework).Object;
            (m_HookHelper as IHookActions).DoActionOnMultiple(pArray, Action);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pUnknown"></param>
        /// <param name="Name"></param>
        /// <param name="Action"></param>
        public void DoActionWithName(object pUnknown, string Name, esriHookActions Action)
        {
            m_HookHelper.Hook = (this.m_Application as IFramework).Object;
            (m_HookHelper as IHookActions).DoActionWithName(pUnknown, Name, Action);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pArray"></param>
        /// <param name="pNamesArray"></param>
        /// <param name="Action"></param>
        public void DoActionWithNameOnMultiple(IArray pArray, IStringArray pNamesArray, esriHookActions Action)
        {
            m_HookHelper.Hook = (this.m_Application as IFramework).Object;
            (m_HookHelper as IHookActions).DoActionWithNameOnMultiple(pArray, pNamesArray, Action);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pUnknown"></param>
        /// <param name="Action"></param>
        /// <returns></returns>
        public bool get_ActionSupported(object pUnknown, esriHookActions Action)
        {
            m_HookHelper.Hook = (this.m_Application as IFramework).Object;
            return (m_HookHelper as IHookActions).get_ActionSupported(pUnknown, Action);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pArray"></param>
        /// <param name="Action"></param>
        /// <returns></returns>
        public bool get_ActionSupportedOnMultiple(IArray pArray, esriHookActions Action)
        {
            m_HookHelper.Hook = (this.m_Application as IFramework).Object;
            return (m_HookHelper as IHookActions).get_ActionSupportedOnMultiple(pArray, Action);
        }
    }
}

